<template>
  <PublicPage page-name="选品中心" :borderType="true">
    <SearchInput placeholder="搜索商品名" v-show="tabsCur==0" :keyword="keyword" @searchFn="goodsSearchListFn"  />
    <SearchInput placeholder="搜索店铺名" v-show="tabsCur==1" :keyword="keyword" @searchFn="shopSearchListFn"  />
    <u-tabs
      :list="tabList"
      :is-scroll="false"
      :current="tabsCur"
      :bold="false"
      :bar-style="{bottom: '-1px !important;'}"
      bar-height="4"
      active-color="#E44435"
      inactive-color="#969799"
      height="92"
      font-size="32"
      @change="_tabsChange"
    />
    <view class="assembly_list_box">
      <!-- 商品 -->
      <SelectGoods v-show="tabsCur==0" :searchCriteria="searchCriteria0" :tabsCur='tabsCur' />
      <!-- 店铺 -->
      <ShopPage v-show="tabsCur==1" :searchCriteria="searchCriteria1" :tabsCur='tabsCur' />
    </view>
  </PublicPage>
</template>
<script>
import SearchInput from "@/components/searchInput/index.vue";
import PublicPage from "@/components/publicPage/index.vue";
import SelectGoods from "../goods/selectGoods.vue";
import ShopPage from "./shopPage.vue";
export default {
  components: {
    SearchInput,
    PublicPage,
    SelectGoods,
    ShopPage
  },
  data () {
    return {
      tabList: [
        {
          value: 1,
          name: '商品'
        },
        {
          value: 2,
          name: '店铺'
        }
      ], // tabs列表
      tabsCur: 0, // tabs当前激活标识
      keyword: '', // 搜索输入框字段
      searchCriteria0: '', // 商品搜索字段
      searchCriteria1: '', // 店铺搜索字段
    }
  },
  // 分享
  onShareAppMessage() {
    return {
      path: '/pages/index/index',
      title: "我想帮你卖货，快来发布商品设置佣金！供货分销轻松收单！",
      imageUrl: `https://qqposs.oss-cn-shenzhen.aliyuncs.com/mpAppImg/bgImg/new_selectGoods_share.png?t=${Date.parse(new Date())}`,
    };
  },
  methods: {
    // 搜索列表
    goodsSearchListFn(val){
      this.searchCriteria0 = val
    },
    shopSearchListFn(val){
      this.searchCriteria1 = val
    },
    // tabs切换
    _tabsChange(index) {
      this.tabsCur = index
    }
  }
}
</script>
<style lang="scss" scoped>
.assembly_list_box {
  height: calc(100% - 192rpx);
}
</style>